//
//  YYENoLoginTableViewCell.m
//  YuYingEDU
//
//  Created by 胡波 on 2018/1/8.
//  Copyright © 2018年 胡波. All rights reserved.
//

#import "YYENoLoginTableViewCell.h"

@interface YYENoLoginTableViewCell ()

@property (nonatomic,strong) UIButton *loginBtn;

@end

@implementation YYENoLoginTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.contentView.backgroundColor = GeneralBackColor;
        
        self.loginBtn = [[UIButton alloc]init];
        [self.loginBtn setTitle:@"立即登录" forState:UIControlStateNormal];
        self.loginBtn.titleLabel.font = [UIFont systemFontOfSize:16];
        self.loginBtn.layer.cornerRadius = 5;
        self.loginBtn.layer.borderColor = GeneralBlueColor.CGColor;
        self.loginBtn.layer.borderWidth = 0.5;
        [self.loginBtn setTitleColor:GeneralBlueColor forState:UIControlStateNormal];
        [self.loginBtn addTarget:self action:@selector(loginClicked) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:self.loginBtn];
        
    }
    return self;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.loginBtn makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(30);
        make.right.equalTo(self.contentView.right).offset(-30);
        make.top.equalTo(self.contentView.top).offset(43);
        make.height.equalTo(42);
    }];
    
}

- (void)loginClicked {
    
    if ([self.delegate respondsToSelector:@selector(Loginimmediately)]) {
        [self.delegate Loginimmediately];
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
